package nc.bs.pub.action;

import nc.bs.framework.common.NCLocator;
import nc.bs.pubapp.pf.action.AbstractPfAction;
import nc.bs.pubapp.pub.rule.ApproveStatusCheckRule;
import nc.impl.pubapp.pattern.rule.IRule;
import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser;
import nc.vo.pub.BusinessException;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;

import nc.bs.yst.scjh.plugin.bpplugin.ScjhPluginPoint;
import nc.vo.uap.hoh002.AggScjhHVO;
import nc.itf.yst.IScjhMaintain;

public class N_H0H2_APPROVE extends AbstractPfAction<AggScjhHVO> {

	public N_H0H2_APPROVE() {
		super();
	}

	@Override
	protected CompareAroundProcesser<AggScjhHVO> getCompareAroundProcesserWithRules(
			Object userObj) {
		CompareAroundProcesser<AggScjhHVO> processor = new CompareAroundProcesser<AggScjhHVO>(
				ScjhPluginPoint.APPROVE);
		processor.addBeforeRule(new ApproveStatusCheckRule());
		return processor;
	}

	@Override
	protected AggScjhHVO[] processBP(Object userObj,
			AggScjhHVO[] clientFullVOs, AggScjhHVO[] originBills) {
		AggScjhHVO[] bills = null;
		IScjhMaintain operator = NCLocator.getInstance().lookup(
				IScjhMaintain.class);
		try {
			bills = operator.approve(clientFullVOs, originBills);
		} catch (BusinessException e) {
			ExceptionUtils.wrappBusinessException(e.getMessage());
		}
		return bills;
	}

}
